from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
def index(request):
    # 1.设置session的值   默认过期时间None  2周  14天
    request.session['NAME'] = 'baoke'

    # set_expiry  设置过期时间
    request.session.set_expiry(3600)

    request.session['ONE'] = '6666'
    request.session['TWO'] = '88888888'

    # 2. 读取session值
    print(request.session['NAME'])  #  baoke

    # 3.清空 整条 session的值
    # request.session.flush()

    # 4.清空 某个session的值
    # del request.session['NAME']

    # 5.清空 session的所有值
    # request.session.clear()

    return HttpResponse("操作session.......")